/*
 * isBST.cpp
 *
 *  Created on: Jul 8, 2012
 *      Author: jh238d
 */

#include "BSTNode.h"
#include <iostream>
#include <climits>
using namespace std;

bool isBSTHelper(BSTNode* root, int min, int max){
	if(!root) return true;
	if(min < root->data && root->data < max){
		return isBSTHelper(root->left, min, root->data) && isBSTHelper(root->right, root->data, max);
	}else
		return false;
}

bool isBST(BSTNode* root){
	return isBSTHelper(root, INT_MIN, INT_MAX);
}
